package JSP;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;

/***
 *@title $NAME
 *@description <TODO description class purpose>
 *@author Tang'ya'kang
 *@VERSION 1.0.0
 *@CREATE 2023/5/7 19:48
 **/
public class Servlet_1 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        Writer writer=response.getWriter();
        writer.write("<!DOCTYPE html>");
        writer.write("<html lang=\"en\">");
        writer.write("<head>");
        writer.write("    <meta charset=\"UTF-8\">");
        writer.write("    <title>用户注册</title>");
        writer.write("    <style>");
        writer.write("        body{");
        writer.write("            background-image: url(\"jp.jpg\");");
        writer.write("            background-size: cover;");
        writer.write("        }");
        writer.write("    </style>");
        writer.write("</head>");
        writer.write("<body>");
        writer.write("        <div align=\"center\">");
        writer.write("            <form action=\"servlet1\">");
        writer.write("                <input type=\"submit\" formmethod=\"post\">");
        writer.write("            </form>");
        writer.write("        </div>");
        writer.write("</body>");
        writer.write("</html>");
        writer.write("这个是servelet输出的html页面");
    }
}
